package Business;

import java.lang.reflect.InvocationTargetException;

/**
 * 交警类
 */

public class Trafflc{
    /**
     * 交警
     */
    public String trafficpolice;
    /**
     * 警号
     */
    public int Alarm;
    /**
     * 红绿灯
     */
    public String trafficlights;
    public Trafflc(String trafficpolice){
        this("交警",123456,"红绿灯");
    }




    public Trafflc(String trafficpolice,int alarm,String trafficlights){
        this.trafficpolice=trafficpolice;
        this.Alarm=alarm;
        this.trafficlights=trafficlights;



    }


    public void yonghu(Driver driver){
        System.out.println("你好,"+trafficpolice+"我的警号是"+Alarm+"你刚驾驶"+driver.Car+"违反了交通规则，" +
                "闯了"+trafficlights+",请下车接受处罚");
    }
    public void intro(Driver driver){
        System.out.println(driver.masterworker+"有一辆"+driver.Car+"ct5");

    }
    public static void main(String[]args){
        Trafflc trafflc=new Trafflc("李警官",123456,"红灯");
        Driver driver=new Driver("小车","货车","王师傅");
        System.out.println();
        Driver driver1=new Driver("凯迪拉克","","李老板");

        trafflc.yonghu(driver);
        trafflc.intro(driver1);




    }


}


